﻿//加载进度条
(function () {

    var width_load = 0, load_timeout;
    Progress = function () {
        this.setWidth = function (value) {
            width_load = value;
        }
        this.getWidth = function () {
            return width_load;
        } 
    };
    Progress.prototype.clear = function () {
        width_load = 0;
        $('#timer').width(width_load + '%');
        clearTimeout(load_timeout);
    }
    Progress.prototype.go = function () {
        width_load += 1 / 8;
        $('#timer').width(width_load + '%');
        load_timeout = setTimeout(Progress.prototype.go, 10);
        if (width_load >= 100)
            Progress.prototype.clear();
    }; 
})();
new Progress().go();

$(function () {
    var iframe = $("#frame_content");
    //链接按钮加载页面
    iframe.on('load', function () {
        var height = $(this).contents().find("body").height();
        $(this).height(height);
        window.scrollTo(0, 0);
        new Progress().clear();
    });  
    //刷新
    $('#html-reload').click(function () {
        new Progress().go(); 
        iframe.attr('src', iframe.attr('src'));
    });
    //后退
    $('#html-back').click(function () { 
        document.getElementById('frame_content').contentWindow.history.back();
    });
    //前进
    $('#html-forward').click(function () {
        document.getElementById('frame_content').contentWindow.history.forward();
    });
});



























